﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpLite.Domain;
using System.ComponentModel.DataAnnotations;

namespace DAEProde.Domain
{
    public class Ticket : Entity
    {
        [Display(Name = "Puntaje")]
        public virtual int MatchDateScore { get; set; }

        [Display(Name = "Usuario")]
        public virtual string UserName { get; set; }
        
        [Display(Name = "Fecha")]
        public virtual MatchDate MatchDate { get; set; }

        [Display(Name = "Pronosticos")]
        public virtual IList<Prediction> Predictions { get; set; }

        public Ticket()
        {
            Predictions = new List<Prediction>();
        }

        public Ticket(string u, MatchDate m)
        {
            UserName = u;

            MatchDate = m;

            Predictions = new List<Prediction>();

            for (var i = 0; i < m.Matches.Count; i++)
            {
                Predictions.Add(new Prediction { Ticket = this, Will = "Sin Asignar", Match = m.Matches.ElementAt(i) });
            }
        }
    }
}
